Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: Imaging with QuickDraw

Previous | Chapter Top | Chapter Contents | Next |

'PICT' Files, 'PICT' Resources, and the 'PICT' Scrap Format

QuickDraw provides routines for creating and drawing pictures; to read pictures from and to write pictures to disk, you use File Manager and Resource Manager routines. To read pictures from and write pictures to the scrap, you use Scrap Manager routines.

Files consist of two forks: a data fork and a resource fork. A data fork is the part of a file that contains data accessed using the File Manager. This data usually corresponds to data entered by the user. A resource fork is the part of a file that contains the file's resources, which contain data accessed using the Resource Manager. This data usually corresponds to data--such as menu, icon, and control definitions--created by the application developer, but it may also include data created by the user while the application is running.

A picture can be stored in the data fork of a file of type 'PICT' . A picture can also be stored as a resource of type 'PICT' in the resource fork of any file type.

Normally, an application sets the file type in the file's FInfo record when the application creates a new file; for example, the File Manager function FSpCreate takes a four-character file type--such as 'PICT' --as a parameter. The data fork of a 'PICT' file begins with a 512-byte header that applications can use for their own purposes. A Picture record follows this header. To read and write 'PICT' files, your application should use File Manager routines.

You may find it useful to store pictures in the resource fork of your application or document file. For example, in response to the user choosing the About command in the Apple menu for your application, you might wish to display a window containing your company's logo. Or, if yours is a page-layout application, you might want to store all the images created by the user for a document as resources in the document file.

You can use high-level tools like the ResEdit resource editor, available from APDA, to create and store pictures as 'PICT' resources for distribution with your files. To create 'PICT' resources while your application is running, you should use Resource Manager routines. To retrieve a picture stored in a 'PICT' resource, you can use the GetPicture function.

For each application, the Scrap Manager maintains a storage area to hold the last data cut or copied by the user. The area that is available to your application for this purpose is called the scrap. The scrap can reside either in memory or on disk. All applications that support copy-and-paste operations read data from and write data to the scrap. The 'PICT' scrap format is one of two standard scrap formats. (The other is 'TEXT' .) To support copy-and-paste operations, your application should use Scrap Manager routines to read and write data in 'PICT' scrap format.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next